package com.qcby.shujia.demo.util;

import java.security.SecureRandom;
import java.util.Random;

/**
 * @className: VerCodeGenerateUtil
 * @description: TODO 类描述
 * @author: whz
 * @date: 2021/11/26
 **/
public class VerCodeGenerateUtil {
    private static final String SYMBOLS = "0123456789";//ABCDEFGHIGKLMNOPQRSTUVWXYZ
    private static final Random RANDOM = new SecureRandom();
    //    生成 6 位数的随机数字
    public static String generateVerCode() {
        char[] numbers = new char[4];
        for (int i = 0; i < numbers.length; i++) {
            numbers[i] = SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length()));
        }
        return new String(numbers);
    }

}
